package com.rsk.dao;

import com.rsk.entity.SysCompanys;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

@Repository
public interface SysCompanysRepository extends JpaRepository<SysCompanys, Long>, JpaSpecificationExecutor<SysCompanys>, Serializable {


    @Modifying
    @Query(value = "update sys_companys set is_del = 1, operator_user =?2, operator_time = NOW() where id =?1", nativeQuery = true)
    public int delSysCompanys(Long id, Long operatorUser);


    @Query(value = "select 1 from sys_companys where company_attribute =?1, company_name =?2,company_typeId = ?3 and is_del = 0", nativeQuery = true)
    List<Map<String,Object>> selectSysCompanys(Long companyAttribute, String companyName, Long companyTypeId);
}
